import useRequest from "@/utils/request";

const request = useRequest({});
//订单列表
export function getOrderList(params: any) {
  return request.get(`/cj-stadium/sys/order/getOrderList`, {
    params,
  });
}

// 订单删除
export function deleteOrder(id: string | number) {
  return request.get(`/cj-stadium/sys/order/delete/${id}`);
}

//订单统计
export function getOrderCount(params: any) {
  return request.get(`/cj-stadium/sys/order/getOrderCount`, {
    params,
  });
}

//订单预约列表
export function getAppointmentList(id: string | number) {
  return request.get(`/cj-stadium/sys/order/getAppointmentList`, {
    params: {
      orderId: id,
    },
  });
}

//订单预约列表
export function getUserData(userId: string | number) {
  return request.get(`/cj-stadium/sys/order/getUserData`, {
    params: {
      userId,
    },
  });
}

// 订单详情
export function getOrderDetail(id: string | number) {
  return request.get(`/cj-stadium/sys/order/getOrderDetail`, {
    params: {
      orderId: id,
    },
  });
}

// 场馆-根据场馆id查询场地以及预约时段
export function getSiteListAndTimes(data: any) {
  return request.post(`/cj-stadium/sys/stadium/getSiteListAndTimes`, data);
}

//查询小程序用户可用全免优惠券
export function getCouponListByQuery(params: any) {
  return request.get(`/cj-stadium/sys/coupon/getCouponListByQuery`, {
    params,
  });
}

// 商家pc端新增订单
export function addOrder(data: any) {
  return request.post(`/cj-stadium/sys/order/addOrder`, data);
}

//pc订单-根据核销码查询订单详情
export function getOrderDetailByCode(params: any) {
  return request.get(`/cj-stadium/sys/order/getOrderDetailByCode`, {
    params,
  });
}
//订单-核销记录列表
export function getWriteOrderList(params: any) {
  return request.get(`/cj-stadium/sys/order/getWriteOrderList`, {
    params,
  });
}
// 核销验证码
export function writeCode(params: any) {
  return request.get(`/cj-stadium/sys/bulletin/writeCode`, {
    params,
  });
}
//订单-核销记录删除
export function deleteWriteRecord(params: any) {
  return request.get(`/cj-stadium/sys/order/deleteWriteRecord`, {
    params,
  });
}

//客户诉求-客户诉求保存
export function saveOrderDispose(data: any) {
  return request.post(`/cj-stadium/sys/orderDemand/saveOrderDispose`, data);
}

//客户诉求-客户诉求保存
export function getOrderDisposeList(params: any) {
  return request.get(`/cj-stadium/sys/orderDemand/getOrderDisposeList`, {
    params,
  });
}

//客户诉求-客户诉求删除
export function delOrderDispose(id: string | number) {
  return request.get(`/cj-stadium/sys/orderDemand/delOrderDispose`, {
    params: { id },
  });
}

// 订单-超时订单处理
export function timeOutOrderDispose(id: string | number) {
  return request.get(`/cj-stadium/sys/order/timeOutOrderDispose`, {
    params: { orderId: id },
  });
}

// 订单-场地看板根据手机号和日期查询订单基础信息
export function getOrderBasicInfo(params: any) {
  return request.get(`/cj-stadium/sys/order/getOrderBasicInfo`, {
    params,
  });
}